package com.aat.dxfy.futurejdk;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;

public class Test {

	public static void main(String[] args) throws InterruptedException, ExecutionException {
		FutureTask<String> f = new FutureTask<String>(new RealData("name"));
		ExecutorService exec = Executors.newFixedThreadPool(1);

		exec.submit(f);
		System.out.println("request over..."+f.isDone());
		try {
			Thread.sleep(2000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println("data = " + f.get()+"  "+f.isDone());
	}

}
